<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:oc="http://java.sun.com/jsf/composite/owncomponents"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="template/template.xhtml">
		<ui:define name="content">
			<h:form id="form" styleClass="horizontal_full">
				<p:panel>
					<h1>User Update</h1>
							
					    <h:panelGrid id="userConfig" columns="4" rowClasses="height50">
					    	
					    	<h:outputText value="Nickname"></h:outputText>
					        <p:inputText id="name" value="#{adminMBean.userName}" required="true">
					        	<f:validateLength minimum="1" maximum="65" />
					        </p:inputText>
					        <p></p>
					        <oc:fieldhelp helptext="Nickname of the User/Company" show="true"/>
   								    	
					    	<h:outputText value="Mails"></h:outputText>
					        <p:inputTextarea id="mails" rows="5" cols="30" counter="display" value="#{adminMBean.userMail}" maxlength="500" counterTemplate="{0} characters remaining." autoResize="false" required="false"/>
    						<h:outputText id="display" />
					        <oc:fieldhelp helptext="Email address for the User/Company" show="true"/>

					    </h:panelGrid>
					    
					    <p></p>
					    
					    <h:outputText value="Set Password "/>
					    <p:selectBooleanCheckbox value="#{adminMBean.setPassword}">
								<p:ajax event="change" update=":form"/>
						</p:selectBooleanCheckbox>
						
						<p></p>
							
						<h:panelGrid id="passwordPanel" columns="4" rowClasses="height50" rendered="#{adminMBean.setPassword}">
							<h:outputLabel for="pwd1" value="Password" />
        					<p:password id="pwd1" value="#{adminMBean.userPassword}" match="pwd2" label="Password 1" required="true" feedback="true">
        						<f:validateLength minimum="8" /> 
        					</p:password>
 							<p></p>
					        <oc:fieldhelp helptext="Password for the User/Company for the login" show="true"/>
 							
        					<h:outputLabel for="pwd2" value="Repeat Password" />
        					<p:password id="pwd2" value="#{adminMBean.userPassword}" label="Password 2" required="true" />
							<p></p>
					        <oc:fieldhelp helptext="Password for the User/Company for the login" show="true"/>
  						</h:panelGrid>
  						
  						<h:outputText value="Set Image/Budget"/>
					    <p:selectBooleanCheckbox value="#{adminMBean.setImageBudget}">
								<p:ajax event="change" update=":form"/>
						</p:selectBooleanCheckbox>
						
						<p></p>
							
						<h:panelGrid id="imageBudgetPanel" columns="4" rowClasses="height50" rendered="#{adminMBean.setImageBudget}">
							
							<h:outputLabel for="userImage" value="Image" />
        					<p:inputText id="userImage" value="#{adminMBean.userImage}" required="true">
 								<f:validateLongRange minimum="0" maximum="1" />
        					</p:inputText>
 							<p></p>
					        <oc:fieldhelp helptext="Image value between 0 and 1 for the company." show="true"/>
 							
        					<h:outputLabel for="userBudget" value="Budget" />
        					<p:inputText id="userBudget" value="#{adminMBean.userBudget}" required="true">
 								<f:convertNumber type="number" />
        					</p:inputText>
 							<p></p>
					        <oc:fieldhelp helptext="Budget for the company." show="true"/>
  						</h:panelGrid>
  						

  						<p></p>
					    
					    <p:commandButton action="#{adminMBean.actionUpdateUser()}" id="saveButton" value="Save" update=":messages" icon="ui-icon-disk" title="Icon Only" />
						
						<p:commandButton action="#{adminMBean.actionAbortUser()}" id="abortButton" value="Abort" update=":messages" icon="ui-icon-circle-close" title="Icon Only" immediate="true"/>
						
						
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>